import {goto} from "../util/request";

/**
 * 原神物品对照表
 * */


// 米游社
export const mhy = {
  id: 'mhy',
  url: 'https://bbs.mihoyo.com'
}
// 拆包网
export const cb = {
  id: 'cb',
  url: 'https://genshin.honeyhunterworld.com'
}

export const srole = {
  name: '',
  star: -1,
  el: -1,
  wpt: -1,
  area: -1,
  book: -1,
  week: 0,
}

export const jyInfo = {
  // 宝钱和好感上限
  mx: [
    {"lvl":10,"bq":2400,"hg":500},
    {"lvl":9,"bq":2200,"hg":450},
    {"lvl":8,"bq":2000,"hg":400},
    {"lvl":7,"bq":1800,"hg":350},
    {"lvl":6,"bq":1600,"hg":300},
    {"lvl":5,"bq":1400,"hg":250},
    {"lvl":4,"bq":1200,"hg":200},
    {"lvl":3,"bq":900,"hg":150},
    {"lvl":2,"bq":600,"hg":100},
    {"lvl":1,"bq":300,"hg":50},
  ],
  // 产量速度 个/小时
  sp: [
    {"xl":20000,"bqsd":30,"hgsd":5},
    {"xl":15000,"bqsd":28,"hgsd":5},
    {"xl":12000,"bqsd":26,"hgsd":5},
    {"xl":10000,"bqsd":24,"hgsd":4},
    {"xl":8000,"bqsd":22,"hgsd":4},
    {"xl":6000,"bqsd":20,"hgsd":4},
    {"xl":4500,"bqsd":16,"hgsd":3},
    {"xl":3000,"bqsd":12,"hgsd":3},
    {"xl":2000,"bqsd":8,"hgsd":2},
    {"xl":0,"bqsd":4,"hgsd":2},
  ]
}

export const riskForm = {
  mjsb: {v: 0, sz: 40, nm: '秘境x2'},    //秘境x2
  boss: {v: 0, sz: 40, nm: '世界BOSS'},    //boss
  hc: {v: 0, sz: 40, nm: '通用40'},      //合成或通用 40
  ty: {v: 0, sz: 20, nm: '通用20'},      //通用 20
  zbzj: {v: 0, sz: 30, nm: '周本(半价)'},    //周本/2
  zb: {v: 0, sz: 60, nm: '周本'},      //周本
  dmsb: {v: 0, sz: 40, nm: '地脉x2'},    //地脉x2
  mj: {v: 0, sz: 20, nm: '秘境'},      //秘境
  dm: {v: 0, sz: 20, nm: '地脉'},      //地脉
}
export function riskChk(form) {
  let flag = false
  const keys = Object.keys(form)
  for(let i = 0; i < keys.length; ++i) {
    if(form[keys[i]].v !== 0) {
      flag = true
      break
    }
  }
  console.log(flag);
  return flag
}

export function riskSz(form) {
  let szs = 0
  const keys = Object.keys(form)
  for(let i = 0; i < keys.length; ++i) {
    if(form[keys[i]].v !== 0) {
      console.log(form[keys[i]], '++');
      szs += form[keys[i]].v * form[keys[i]].sz
    }
  }
  return szs
}

/** 7大元素 */
export const El = [
  {"el":"-1","el_name":"全部"},
  {"el":0,"el_name":"火"},
  {"el":1,"el_name":"水"},
  {"el":2,"el_name":"雷"},
  {"el":3,"el_name":"冰"},
  {"el":4,"el_name":"风"},
  {"el":5,"el_name":"岩"},
  {"el":6,"el_name":"草"},
]

/** 武器类型 */
export const Wpt = [
  {"wpt":0,"wpt_name":"单手剑"},
  {"wpt":1,"wpt_name":"双手剑"},
  {"wpt":2,"wpt_name":"弓"},
  {"wpt":3,"wpt_name":"长柄"},
  {"wpt":4,"wpt_name":"法器"},
]

/** 地区 */
export const Area = [
  {"area":"-1","area_name":"其他"},
  {"area":0,"area_name":"蒙德"},
  {"area":1,"area_name":"璃月"},
  {"area":2,"area_name":"稻妻"},
  {"area":3,"area_name":"至冬"},
]

/** 天赋书 */
export const Book = [
  {"book":"-1","book_name":"全部"},
  {"book":0,"book_name":"「自由」"},
  {"book":1,"book_name":"「抗争」"},
  {"book":2,"book_name":"「诗文」"},
  {"book":3,"book_name":"「繁荣」"},
  {"book":4,"book_name":"「勤劳」"},
  {"book":5,"book_name":"「黄金」"},
  {"book":6,"book_name":"「浮世」"},
  {"book":7,"book_name":"「风雅」"},
  {"book":8,"book_name":"「天光」"},
]

/** 武器材料 */
export const Cl = [
  {"book":"-1","cl_name":"全部"},
  {"cl":0,"cl_name":"高塔孤王"},
  {"cl":1,"cl_name":"凛风奔狼"},
  {"cl":2,"cl_name":"狮牙斗士"},
  {"cl":3,"cl_name":"孤云寒林"},
  {"cl":4,"cl_name":"雾海云间"},
  {"cl":5,"cl_name":"漆黑陨铁"},
  {"cl":6,"cl_name":"远海夷地"},
  {"cl":7,"cl_name":"鸣神御灵"},
  {"cl":8,"cl_name":"今昔剧画"},
]
